package com.seckill.order.lock;



import java.util.concurrent.TimeUnit;

public interface RedisLock {
    /**
     * 加锁操作
     *
     * @param key
     * @param timeout
     * @param
     * @return
     */
    boolean tryLock(String key, Long timeout, TimeUnit timeUnit);

    /**
     * 枷锁,底层会自动给分布式锁续期
     * @param key
     * @return
     */
    boolean tryLock(String key);


    boolean tryLock(Long waitTime, TimeUnit unit, String key);

    /**
     * 解锁操作
     *
     * @param key
     */
    void unLock(String key) throws InterruptedException;

}
